const Router = require('koa-router')
const router = new Router()
const home = require('./home')
const login = require('./login')
const search = require('./search')
const getdata = require('./getdata')
const comments = require('./comments')
const files = require('./files')
const remove = require('./remove')

Date.prototype.Format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "H+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}

router.use('/home', home.routes(),home.allowedMethods())
router.use('/login', login.routes(),login.allowedMethods())
router.use('/search', search.routes(),search.allowedMethods())
router.use('/getdata', getdata.routes(),getdata.allowedMethods())
router.use('/comments', comments.routes(),comments.allowedMethods())
router.use('/files', files.routes(),files.allowedMethods())
router.use('/remove', remove.routes(),remove.allowedMethods())

module.exports = router
